package goleetcode

func numberOfBoomerangs(points [][]int) int {
	ans := 0
	for _, p := range points {
		cnt := map[int]int{}
		for _, q := range points {
			dis := (p[0] - q[0]) * (p[0] - q[0]) + (p[1] - q[1])*(p[1] - q[1])
			cnt[dis]++
		}
		for _, m := range cnt {
			ans += m * (m -1)
		}
	}
	return ans
}